let obj = {};
function getSum(a, b) {
  console.log("a+b的和为", a + b);
}

obj["add"] = getSum;

obj.add(3, 4);

let myObj = {
  age: 19,
  name: "hello",
};

function getThis() {
  console.log(this);
  //取决于实例对象上有没有这个属性
  //如果有则取值，没有则为undefined
  console.log("年龄为", this.age);
}

myObj["getThis"] = getThis;

//调用方法
myObj.getThis();

myObj["sayName"] = () => {
  console.log("myName");
};

console.log(myObj);
myObj.sayName();
